﻿/********************************************************************
	created:	2011-9-12   12:43
	author:		Lifan Su
	
	purpose:	Test case for relational functions.
*********************************************************************/


#include <_stdint.h>

#include <crc32.h>
#include <crc64.h>
#include <md5.h>
#include <sha1.h>
#include <sha224.h>
#include <sha256.h>
#include <sha384.h>
#include <sha512.h>
#include <tiger192.h>

#include <time.h>
#include <stdlib.h>
#include <stdio.h>

uint8_t gen_byte();
uint32_t gen_32();
uint64_t gen_64();

void gen_crc32(struct CRC32_d *dst);
void gen_crc64(struct CRC64_d *dst);
void gen_md5(struct MD5_d *dst);
void gen_sha1(struct SHA1_d *dst);
void gen_sha224(struct SHA224_d *dst);
void gen_sha256(struct SHA256_d *dst);
void gen_sha384(struct SHA384_d *dst);
void gen_sha512(struct SHA512_d *dst);
void gen_tiger192(struct TIGER192_d *dst);

void test_crc32();
void test_crc64();
void test_md5();
void test_sha1();
void test_sha224();
void test_sha256();
void test_sha384();
void test_sha512();
void test_tiger192();

int main()
{
    srand((unsigned) time(NULL));

    test_crc32();
    printf("\n");
    test_crc64();
    printf("\n");
    test_md5();
    printf("\n");
    test_sha1();
    printf("\n");
    test_sha224();
    printf("\n");
    test_sha256();
    printf("\n");
    test_sha384();
    printf("\n");
    test_sha512();
    printf("\n");
    test_tiger192();
}

uint8_t gen_byte()
{
    return rand();
}

uint32_t gen_32()
{
    return ((uint32_t)(gen_byte()) << 24)
        |  ((uint32_t)(gen_byte()) << 16)
        |  ((uint32_t)(gen_byte()) << 8)
        |  ((uint32_t)(gen_byte()));
}

uint64_t gen_64()
{
    return (((uint64_t)gen_32() << 32) | gen_32());
}

void gen_crc32(struct CRC32_d *dst)
{
    dst->hash[0] = gen_32();
}
void gen_crc32_similar(struct CRC32_d *dst, struct CRC32_d *src)
{
    dst->hash[0] = src->hash[0] ^ gen_byte();
}

void gen_crc64(struct CRC64_d *dst)
{
    dst->hash[0] = gen_64();
}
void gen_crc64_similar(struct CRC64_d *dst, struct CRC64_d *src)
{
    dst->hash[0] = src->hash[0] ^ gen_byte();
}

void gen_md5(struct MD5_d *dst)
{
    dst->hash[0] = gen_32();
    dst->hash[1] = gen_32();
    dst->hash[2] = gen_32();
    dst->hash[3] = gen_32();
}
void gen_md5_similar(struct MD5_d *dst, struct MD5_d *src)
{
    dst->hash[0] = src->hash[0];
    dst->hash[1] = src->hash[1];
    dst->hash[2] = src->hash[2];
    dst->hash[3] = src->hash[3] ^ gen_byte();
}

void gen_sha1(struct SHA1_d *dst)
{
    dst->hash[0] = gen_32();
    dst->hash[1] = gen_32();
    dst->hash[2] = gen_32();
    dst->hash[3] = gen_32();
    dst->hash[4] = gen_32();
}
void gen_sha1_similar(struct SHA1_d *dst, struct SHA1_d *src)
{
    dst->hash[0] = src->hash[0];
    dst->hash[1] = src->hash[1];
    dst->hash[2] = src->hash[2];
    dst->hash[3] = src->hash[3];
    dst->hash[4] = src->hash[4] ^ gen_byte();
}

void gen_sha224(struct SHA224_d *dst)
{
    dst->hash[0] = gen_32();
    dst->hash[1] = gen_32();
    dst->hash[2] = gen_32();
    dst->hash[3] = gen_32();
    dst->hash[4] = gen_32();
    dst->hash[5] = gen_32();
    dst->hash[6] = gen_32();
}
void gen_sha224_similar(struct SHA224_d *dst, struct SHA224_d *src)
{
    dst->hash[0] = src->hash[0];
    dst->hash[1] = src->hash[1];
    dst->hash[2] = src->hash[2];
    dst->hash[3] = src->hash[3];
    dst->hash[4] = src->hash[4];
    dst->hash[5] = src->hash[5];
    dst->hash[6] = src->hash[6] ^ gen_byte();
}

void gen_sha256(struct SHA256_d *dst)
{
    dst->hash[0] = gen_32();
    dst->hash[1] = gen_32();
    dst->hash[2] = gen_32();
    dst->hash[3] = gen_32();
    dst->hash[4] = gen_32();
    dst->hash[5] = gen_32();
    dst->hash[6] = gen_32();
    dst->hash[7] = gen_32();
}
void gen_sha256_similar(struct SHA256_d *dst, struct SHA256_d *src)
{
    dst->hash[0] = src->hash[0];
    dst->hash[1] = src->hash[1];
    dst->hash[2] = src->hash[2];
    dst->hash[3] = src->hash[3];
    dst->hash[4] = src->hash[4];
    dst->hash[5] = src->hash[5];
    dst->hash[6] = src->hash[6];
    dst->hash[7] = src->hash[7] ^ gen_byte();
}

void gen_sha384(struct SHA384_d *dst)
{
    dst->hash[0] = gen_64();
    dst->hash[1] = gen_64();
    dst->hash[2] = gen_64();
    dst->hash[3] = gen_64();
    dst->hash[4] = gen_64();
    dst->hash[5] = gen_64();
}
void gen_sha384_similar(struct SHA384_d *dst, struct SHA384_d *src)
{
    dst->hash[0] = src->hash[0];
    dst->hash[1] = src->hash[1];
    dst->hash[2] = src->hash[2];
    dst->hash[3] = src->hash[3];
    dst->hash[4] = src->hash[4];
    dst->hash[5] = src->hash[5] ^ gen_byte();
}

void gen_sha512(struct SHA512_d *dst)
{
    dst->hash[0] = gen_64();
    dst->hash[1] = gen_64();
    dst->hash[2] = gen_64();
    dst->hash[3] = gen_64();
    dst->hash[4] = gen_64();
    dst->hash[5] = gen_64();
    dst->hash[6] = gen_64();
    dst->hash[7] = gen_64();
}
void gen_sha512_similar(struct SHA512_d *dst, struct SHA512_d *src)
{
    dst->hash[0] = src->hash[0];
    dst->hash[1] = src->hash[1];
    dst->hash[2] = src->hash[2];
    dst->hash[3] = src->hash[3];
    dst->hash[4] = src->hash[4];
    dst->hash[5] = src->hash[5];
    dst->hash[6] = src->hash[6];
    dst->hash[7] = src->hash[7] ^ gen_byte();
}

void gen_tiger192(struct TIGER192_d *dst)
{
    dst->hash[0] = gen_64();
    dst->hash[1] = gen_64();
    dst->hash[2] = gen_64();
}
void gen_tiger192_similar(struct TIGER192_d *dst, struct TIGER192_d *src)
{
    dst->hash[0] = src->hash[0];
    dst->hash[1] = src->hash[1];
    dst->hash[2] = src->hash[2] ^ gen_byte();
}


void test_crc32()
{
    struct CRC32_d _1, _2, _s;
    char _1c[9], _2c[9], _sc[9];

    gen_crc32(&_1);
    gen_crc32(&_2);
    gen_crc32_similar(&_s, &_1);

    crc32_d_print(_1c, &_1);
    crc32_d_print(_2c, &_2);
    crc32_d_print(_sc, &_s);

    printf("CRC32 value %s is less than %s: %s\n", _1c, _1c, crc32_d_less(&_1, &_1) ? "true" : "false");
    printf("CRC32 value %s is less than %s: %s\n", _1c, _2c, crc32_d_less(&_1, &_2) ? "true" : "false");
    printf("CRC32 value %s is less than %s: %s\n", _2c, _1c, crc32_d_less(&_2, &_1) ? "true" : "false");
    printf("CRC32 value %s is less than %s: %s\n", _2c, _2c, crc32_d_less(&_2, &_2) ? "true" : "false");

    printf("CRC32 value %s is equal to %s: %s\n", _1c, _1c, crc32_d_eq(&_1, &_1) ? "true" : "false");
    printf("CRC32 value %s is equal to %s: %s\n", _1c, _2c, crc32_d_eq(&_1, &_2) ? "true" : "false");
    printf("CRC32 value %s is equal to %s: %s\n", _2c, _1c, crc32_d_eq(&_2, &_1) ? "true" : "false");
    printf("CRC32 value %s is equal to %s: %s\n", _2c, _2c, crc32_d_eq(&_2, &_2) ? "true" : "false");

    printf("CRC32 value %s is less than %s: %s\n", _1c, _sc, crc32_d_less(&_1, &_s) ? "true" : "false");
    printf("CRC32 value %s is less than %s: %s\n", _sc, _1c, crc32_d_less(&_s, &_1) ? "true" : "false");
    printf("CRC32 value %s is less than %s: %s\n", _sc, _sc, crc32_d_less(&_s, &_s) ? "true" : "false");

    printf("CRC32 value %s is equal to %s: %s\n", _1c, _sc, crc32_d_eq(&_1, &_s) ? "true" : "false");
    printf("CRC32 value %s is equal to %s: %s\n", _sc, _1c, crc32_d_eq(&_s, &_1) ? "true" : "false");
    printf("CRC32 value %s is equal to %s: %s\n", _sc, _sc, crc32_d_eq(&_s, &_s) ? "true" : "false");
}

void test_crc64()
{
    struct CRC64_d _1, _2, _s;
    char _1c[17], _2c[17], _sc[17];

    gen_crc64(&_1);
    gen_crc64(&_2);
    gen_crc64_similar(&_s, &_1);

    crc64_d_print(_1c, &_1);
    crc64_d_print(_2c, &_2);
    crc64_d_print(_sc, &_s);

    printf("CRC64 value %s is less than %s: %s\n", _1c, _1c, crc64_d_less(&_1, &_1) ? "true" : "false");
    printf("CRC64 value %s is less than %s: %s\n", _1c, _2c, crc64_d_less(&_1, &_2) ? "true" : "false");
    printf("CRC64 value %s is less than %s: %s\n", _2c, _1c, crc64_d_less(&_2, &_1) ? "true" : "false");
    printf("CRC64 value %s is less than %s: %s\n", _2c, _2c, crc64_d_less(&_2, &_2) ? "true" : "false");

    printf("CRC64 value %s is equal to %s: %s\n", _1c, _1c, crc64_d_eq(&_1, &_1) ? "true" : "false");
    printf("CRC64 value %s is equal to %s: %s\n", _1c, _2c, crc64_d_eq(&_1, &_2) ? "true" : "false");
    printf("CRC64 value %s is equal to %s: %s\n", _2c, _1c, crc64_d_eq(&_2, &_1) ? "true" : "false");
    printf("CRC64 value %s is equal to %s: %s\n", _2c, _2c, crc64_d_eq(&_2, &_2) ? "true" : "false");

    printf("CRC64 value %s is less than %s: %s\n", _1c, _sc, crc64_d_less(&_1, &_s) ? "true" : "false");
    printf("CRC64 value %s is less than %s: %s\n", _sc, _1c, crc64_d_less(&_s, &_1) ? "true" : "false");
    printf("CRC64 value %s is less than %s: %s\n", _sc, _sc, crc64_d_less(&_s, &_s) ? "true" : "false");

    printf("CRC64 value %s is equal to %s: %s\n", _1c, _sc, crc64_d_eq(&_1, &_s) ? "true" : "false");
    printf("CRC64 value %s is equal to %s: %s\n", _sc, _1c, crc64_d_eq(&_s, &_1) ? "true" : "false");
    printf("CRC64 value %s is equal to %s: %s\n", _sc, _sc, crc64_d_eq(&_s, &_s) ? "true" : "false");
}

void test_md5()
{
    struct MD5_d _1, _2, _s;
    char _1c[33], _2c[33], _sc[33];

    gen_md5(&_1);
    gen_md5(&_2);
    gen_md5_similar(&_s, &_1);

    md5_d_print(_1c, &_1);
    md5_d_print(_2c, &_2);
    md5_d_print(_sc, &_s);

    printf("MD5 value %s is less than %s: %s\n", _1c, _1c, md5_d_less(&_1, &_1) ? "true" : "false");
    printf("MD5 value %s is less than %s: %s\n", _1c, _2c, md5_d_less(&_1, &_2) ? "true" : "false");
    printf("MD5 value %s is less than %s: %s\n", _2c, _1c, md5_d_less(&_2, &_1) ? "true" : "false");
    printf("MD5 value %s is less than %s: %s\n", _2c, _2c, md5_d_less(&_2, &_2) ? "true" : "false");

    printf("MD5 value %s is equal to %s: %s\n", _1c, _1c, md5_d_eq(&_1, &_1) ? "true" : "false");
    printf("MD5 value %s is equal to %s: %s\n", _1c, _2c, md5_d_eq(&_1, &_2) ? "true" : "false");
    printf("MD5 value %s is equal to %s: %s\n", _2c, _1c, md5_d_eq(&_2, &_1) ? "true" : "false");
    printf("MD5 value %s is equal to %s: %s\n", _2c, _2c, md5_d_eq(&_2, &_2) ? "true" : "false");

    printf("MD5 value %s is less than %s: %s\n", _1c, _sc, md5_d_less(&_1, &_s) ? "true" : "false");
    printf("MD5 value %s is less than %s: %s\n", _sc, _1c, md5_d_less(&_s, &_1) ? "true" : "false");
    printf("MD5 value %s is less than %s: %s\n", _sc, _sc, md5_d_less(&_s, &_s) ? "true" : "false");

    printf("MD5 value %s is equal to %s: %s\n", _1c, _sc, md5_d_eq(&_1, &_s) ? "true" : "false");
    printf("MD5 value %s is equal to %s: %s\n", _sc, _1c, md5_d_eq(&_s, &_1) ? "true" : "false");
    printf("MD5 value %s is equal to %s: %s\n", _sc, _sc, md5_d_eq(&_s, &_s) ? "true" : "false");
}

void test_sha1()
{
    struct SHA1_d _1, _2, _s;
    char _1c[41], _2c[41], _sc[41];

    gen_sha1(&_1);
    gen_sha1(&_2);
    gen_sha1_similar(&_s, &_1);

    sha1_d_print(_1c, &_1);
    sha1_d_print(_2c, &_2);
    sha1_d_print(_sc, &_s);

    printf("SHA1 value %s is less than %s: %s\n", _1c, _1c, sha1_d_less(&_1, &_1) ? "true" : "false");
    printf("SHA1 value %s is less than %s: %s\n", _1c, _2c, sha1_d_less(&_1, &_2) ? "true" : "false");
    printf("SHA1 value %s is less than %s: %s\n", _2c, _1c, sha1_d_less(&_2, &_1) ? "true" : "false");
    printf("SHA1 value %s is less than %s: %s\n", _2c, _2c, sha1_d_less(&_2, &_2) ? "true" : "false");

    printf("SHA1 value %s is equal to %s: %s\n", _1c, _1c, sha1_d_eq(&_1, &_1) ? "true" : "false");
    printf("SHA1 value %s is equal to %s: %s\n", _1c, _2c, sha1_d_eq(&_1, &_2) ? "true" : "false");
    printf("SHA1 value %s is equal to %s: %s\n", _2c, _1c, sha1_d_eq(&_2, &_1) ? "true" : "false");
    printf("SHA1 value %s is equal to %s: %s\n", _2c, _2c, sha1_d_eq(&_2, &_2) ? "true" : "false");
    
    printf("SHA1 value %s is less than %s: %s\n", _1c, _sc, sha1_d_less(&_1, &_s) ? "true" : "false");
    printf("SHA1 value %s is less than %s: %s\n", _sc, _1c, sha1_d_less(&_s, &_1) ? "true" : "false");
    printf("SHA1 value %s is less than %s: %s\n", _sc, _sc, sha1_d_less(&_s, &_s) ? "true" : "false");
    
    printf("SHA1 value %s is equal to %s: %s\n", _1c, _sc, sha1_d_eq(&_1, &_s) ? "true" : "false");
    printf("SHA1 value %s is equal to %s: %s\n", _sc, _1c, sha1_d_eq(&_s, &_1) ? "true" : "false");
    printf("SHA1 value %s is equal to %s: %s\n", _sc, _sc, sha1_d_eq(&_s, &_s) ? "true" : "false");
}

void test_sha224()
{
    struct SHA224_d _1, _2, _s;
    char _1c[57], _2c[57], _sc[57];

    gen_sha224(&_1);
    gen_sha224(&_2);
    gen_sha224_similar(&_s, &_1);
    
    sha224_d_print(_1c, &_1);
    sha224_d_print(_2c, &_2);
    sha224_d_print(_sc, &_s);

    printf("SHA224 value %s is less than %s: %s\n", _1c, _1c, sha224_d_less(&_1, &_1) ? "true" : "false");
    printf("SHA224 value %s is less than %s: %s\n", _1c, _2c, sha224_d_less(&_1, &_2) ? "true" : "false");
    printf("SHA224 value %s is less than %s: %s\n", _2c, _1c, sha224_d_less(&_2, &_1) ? "true" : "false");
    printf("SHA224 value %s is less than %s: %s\n", _2c, _2c, sha224_d_less(&_2, &_2) ? "true" : "false");

    printf("SHA224 value %s is equal to %s: %s\n", _1c, _1c, sha224_d_eq(&_1, &_1) ? "true" : "false");
    printf("SHA224 value %s is equal to %s: %s\n", _1c, _2c, sha224_d_eq(&_1, &_2) ? "true" : "false");
    printf("SHA224 value %s is equal to %s: %s\n", _2c, _1c, sha224_d_eq(&_2, &_1) ? "true" : "false");
    printf("SHA224 value %s is equal to %s: %s\n", _2c, _2c, sha224_d_eq(&_2, &_2) ? "true" : "false");

    printf("SHA224 value %s is less than %s: %s\n", _1c, _sc, sha224_d_less(&_1, &_s) ? "true" : "false");
    printf("SHA224 value %s is less than %s: %s\n", _sc, _1c, sha224_d_less(&_s, &_1) ? "true" : "false");
    printf("SHA224 value %s is less than %s: %s\n", _sc, _sc, sha224_d_less(&_s, &_s) ? "true" : "false");

    printf("SHA224 value %s is equal to %s: %s\n", _1c, _sc, sha224_d_eq(&_1, &_s) ? "true" : "false");
    printf("SHA224 value %s is equal to %s: %s\n", _sc, _1c, sha224_d_eq(&_s, &_1) ? "true" : "false");
    printf("SHA224 value %s is equal to %s: %s\n", _sc, _sc, sha224_d_eq(&_s, &_s) ? "true" : "false");
}

void test_sha256()
{
    struct SHA256_d _1, _2, _s;
    char _1c[65], _2c[65], _sc[65];

    gen_sha256(&_1);
    gen_sha256(&_2);
    gen_sha256_similar(&_s, &_1);

    sha256_d_print(_1c, &_1);
    sha256_d_print(_2c, &_2);
    sha256_d_print(_sc, &_s);

    printf("SHA256 value %s is less than %s: %s\n", _1c, _1c, sha256_d_less(&_1, &_1) ? "true" : "false");
    printf("SHA256 value %s is less than %s: %s\n", _1c, _2c, sha256_d_less(&_1, &_2) ? "true" : "false");
    printf("SHA256 value %s is less than %s: %s\n", _2c, _1c, sha256_d_less(&_2, &_1) ? "true" : "false");
    printf("SHA256 value %s is less than %s: %s\n", _2c, _2c, sha256_d_less(&_2, &_2) ? "true" : "false");

    printf("SHA256 value %s is equal to %s: %s\n", _1c, _1c, sha256_d_eq(&_1, &_1) ? "true" : "false");
    printf("SHA256 value %s is equal to %s: %s\n", _1c, _2c, sha256_d_eq(&_1, &_2) ? "true" : "false");
    printf("SHA256 value %s is equal to %s: %s\n", _2c, _1c, sha256_d_eq(&_2, &_1) ? "true" : "false");
    printf("SHA256 value %s is equal to %s: %s\n", _2c, _2c, sha256_d_eq(&_2, &_2) ? "true" : "false");

    printf("SHA256 value %s is less than %s: %s\n", _1c, _sc, sha256_d_less(&_1, &_s) ? "true" : "false");
    printf("SHA256 value %s is less than %s: %s\n", _sc, _1c, sha256_d_less(&_s, &_1) ? "true" : "false");
    printf("SHA256 value %s is less than %s: %s\n", _sc, _sc, sha256_d_less(&_s, &_s) ? "true" : "false");

    printf("SHA256 value %s is equal to %s: %s\n", _1c, _sc, sha256_d_eq(&_1, &_s) ? "true" : "false");
    printf("SHA256 value %s is equal to %s: %s\n", _sc, _1c, sha256_d_eq(&_s, &_1) ? "true" : "false");
    printf("SHA256 value %s is equal to %s: %s\n", _sc, _sc, sha256_d_eq(&_s, &_s) ? "true" : "false");
}

void test_sha384()
{
    struct SHA384_d _1, _2, _s;
    char _1c[97], _2c[97], _sc[97];

    gen_sha384(&_1);
    gen_sha384(&_2);
    gen_sha384_similar(&_s, &_1);

    sha384_d_print(_1c, &_1);
    sha384_d_print(_2c, &_2);
    sha384_d_print(_sc, &_s);

    printf("SHA384 value %s is less than %s: %s\n", _1c, _1c, sha384_d_less(&_1, &_1) ? "true" : "false");
    printf("SHA384 value %s is less than %s: %s\n", _1c, _2c, sha384_d_less(&_1, &_2) ? "true" : "false");
    printf("SHA384 value %s is less than %s: %s\n", _2c, _1c, sha384_d_less(&_2, &_1) ? "true" : "false");
    printf("SHA384 value %s is less than %s: %s\n", _2c, _2c, sha384_d_less(&_2, &_2) ? "true" : "false");

    printf("SHA384 value %s is equal to %s: %s\n", _1c, _1c, sha384_d_eq(&_1, &_1) ? "true" : "false");
    printf("SHA384 value %s is equal to %s: %s\n", _1c, _2c, sha384_d_eq(&_1, &_2) ? "true" : "false");
    printf("SHA384 value %s is equal to %s: %s\n", _2c, _1c, sha384_d_eq(&_2, &_1) ? "true" : "false");
    printf("SHA384 value %s is equal to %s: %s\n", _2c, _2c, sha384_d_eq(&_2, &_2) ? "true" : "false");

    printf("SHA384 value %s is less than %s: %s\n", _1c, _sc, sha384_d_less(&_1, &_s) ? "true" : "false");
    printf("SHA384 value %s is less than %s: %s\n", _sc, _1c, sha384_d_less(&_s, &_1) ? "true" : "false");
    printf("SHA384 value %s is less than %s: %s\n", _sc, _sc, sha384_d_less(&_s, &_s) ? "true" : "false");

    printf("SHA384 value %s is equal to %s: %s\n", _1c, _sc, sha384_d_eq(&_1, &_s) ? "true" : "false");
    printf("SHA384 value %s is equal to %s: %s\n", _sc, _1c, sha384_d_eq(&_s, &_1) ? "true" : "false");
    printf("SHA384 value %s is equal to %s: %s\n", _sc, _sc, sha384_d_eq(&_s, &_s) ? "true" : "false");
}

void test_sha512()
{
    struct SHA512_d _1, _2, _s;
    char _1c[129], _2c[129], _sc[129];

    gen_sha512(&_1);
    gen_sha512(&_2);
    gen_sha512_similar(&_s, &_1);

    sha512_d_print(_1c, &_1);
    sha512_d_print(_2c, &_2);
    sha512_d_print(_sc, &_s);

    printf("SHA512 value %s is less than %s: %s\n", _1c, _1c, sha512_d_less(&_1, &_1) ? "true" : "false");
    printf("SHA512 value %s is less than %s: %s\n", _1c, _2c, sha512_d_less(&_1, &_2) ? "true" : "false");
    printf("SHA512 value %s is less than %s: %s\n", _2c, _1c, sha512_d_less(&_2, &_1) ? "true" : "false");
    printf("SHA512 value %s is less than %s: %s\n", _2c, _2c, sha512_d_less(&_2, &_2) ? "true" : "false");

    printf("SHA512 value %s is equal to %s: %s\n", _1c, _1c, sha512_d_eq(&_1, &_1) ? "true" : "false");
    printf("SHA512 value %s is equal to %s: %s\n", _1c, _2c, sha512_d_eq(&_1, &_2) ? "true" : "false");
    printf("SHA512 value %s is equal to %s: %s\n", _2c, _1c, sha512_d_eq(&_2, &_1) ? "true" : "false");
    printf("SHA512 value %s is equal to %s: %s\n", _2c, _2c, sha512_d_eq(&_2, &_2) ? "true" : "false");

    printf("SHA512 value %s is less than %s: %s\n", _1c, _sc, sha512_d_less(&_1, &_s) ? "true" : "false");
    printf("SHA512 value %s is less than %s: %s\n", _sc, _1c, sha512_d_less(&_s, &_1) ? "true" : "false");
    printf("SHA512 value %s is less than %s: %s\n", _sc, _sc, sha512_d_less(&_s, &_s) ? "true" : "false");

    printf("SHA512 value %s is equal to %s: %s\n", _1c, _sc, sha512_d_eq(&_1, &_s) ? "true" : "false");
    printf("SHA512 value %s is equal to %s: %s\n", _sc, _1c, sha512_d_eq(&_s, &_1) ? "true" : "false");
    printf("SHA512 value %s is equal to %s: %s\n", _sc, _sc, sha512_d_eq(&_s, &_s) ? "true" : "false");
}

void test_tiger192()
{
    struct TIGER192_d _1, _2, _s;
    char _1c[49], _2c[49], _sc[49];

    gen_tiger192(&_1);
    gen_tiger192(&_2);
    gen_tiger192_similar(&_s, &_1);

    tiger192_d_print(_1c, &_1);
    tiger192_d_print(_2c, &_2);
    tiger192_d_print(_sc, &_s);

    printf("tiger192 value %s is less than %s: %s\n", _1c, _1c, tiger192_d_less(&_1, &_1) ? "true" : "false");
    printf("tiger192 value %s is less than %s: %s\n", _1c, _2c, tiger192_d_less(&_1, &_2) ? "true" : "false");
    printf("tiger192 value %s is less than %s: %s\n", _2c, _1c, tiger192_d_less(&_2, &_1) ? "true" : "false");
    printf("tiger192 value %s is less than %s: %s\n", _2c, _2c, tiger192_d_less(&_2, &_2) ? "true" : "false");

    printf("tiger192 value %s is equal to %s: %s\n", _1c, _1c, tiger192_d_eq(&_1, &_1) ? "true" : "false");
    printf("tiger192 value %s is equal to %s: %s\n", _1c, _2c, tiger192_d_eq(&_1, &_2) ? "true" : "false");
    printf("tiger192 value %s is equal to %s: %s\n", _2c, _1c, tiger192_d_eq(&_2, &_1) ? "true" : "false");
    printf("tiger192 value %s is equal to %s: %s\n", _2c, _2c, tiger192_d_eq(&_2, &_2) ? "true" : "false");

    printf("tiger192 value %s is less than %s: %s\n", _1c, _sc, tiger192_d_less(&_1, &_s) ? "true" : "false");
    printf("tiger192 value %s is less than %s: %s\n", _sc, _1c, tiger192_d_less(&_s, &_1) ? "true" : "false");
    printf("tiger192 value %s is less than %s: %s\n", _sc, _sc, tiger192_d_less(&_s, &_s) ? "true" : "false");

    printf("tiger192 value %s is equal to %s: %s\n", _1c, _sc, tiger192_d_eq(&_1, &_s) ? "true" : "false");
    printf("tiger192 value %s is equal to %s: %s\n", _sc, _1c, tiger192_d_eq(&_s, &_1) ? "true" : "false");
    printf("tiger192 value %s is equal to %s: %s\n", _sc, _sc, tiger192_d_eq(&_s, &_s) ? "true" : "false");
}
